import React, { useContext } from 'react';
import contextObj from './context';
const Son2 = () => {
    const { state, dispatch } = useContext(contextObj)
    return (
        <div>
            <p onClick={() => {
                dispatch({ type: 'addAge', payload: 2 })
            }}>子组件2--{state.user.name}--{state.user.age}</p>
        </div>
    );
}

export default Son2;
